<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="<?php echo base_url() ?>css/reset.css" type="text/css" rel="stylesheet" media="screen" />
        <link href="<?php echo base_url() ?>css/style.css" type="text/css" rel="stylesheet" media="screen" />
        <title>fashion woman</title>
    </head>
    <body>
        <div id="main_box">
            <h1>Chức năng quản lý sản phẩm</h1>
            <div class="cleared">
<?php
echo anchor(base_url() . 'sanpham/add/', 'Thêm sản phẩm mới');
?>
                <br /><br />
                <?php
                if (!$results) {
                    echo '<h1>No Data</h1>';
                    exit;
                }
                ?>
                <div class="containner" style="margin-right: 5px;">
                    <div class="product_container" style="background: border-box;float: left;">
                        <?php foreach ($results as $sanpham) { ?>
                        <div class="product_detail" style="float:left;">
                            
                            <img src="<?php echo base_url()."upload/img_product/" .$sanpham-> hinh_sp?>" />
                            <p>
                            <?php echo anchor(base_url() . 'sanpham/edit/' . $sanpham->id, 'Edit');?>
                            | &nbsp; <?php echo anchor(base_url() . 'sanpham/delete/' . $sanpham->id, 'Delete', array('onClick' => 'return deletechecked(\' ' . base_url() . 'sanpham/delete/' . $sanpham->id . ' \')'));?>
                            </p>                
                            
                        </div>
                        <div class="product_detail" style="float:left;margin-left:10px;">
                            <ul>
                                <li>
                                   Mã sản phẩm: <?php echo $sanpham->ma_sp?>
                                </li>
                                <li>
                                   Loại sản phẩm: <?php echo $sanpham->ten_chung_loai?>
                                </li>
                                <li>
                                   Tên sản phẩm: <?php echo $sanpham->ten_sp?>
                                </li>
                                <li>
                                   Giá: <?php echo $sanpham->gia?>
                                </li>
                                <li>
                                  Giới thiệu sản phẩm:  <?php echo $sanpham->gioithieu_sp?>
                                </li>
                                <li>
                                   Số lượng:  <?php echo $sanpham->soluong_sp?>
                                </li>
                                <li>
                                    <span style="color: #E13300;"> <?php echo ($sanpham->sp_xuhuong ==1)?"Đang là sản phẩm xu hướng": "Không phải sản phẩm xu hướng"?></span>
                                </li>
                            </ul>
                        </div>
                        <?php } ?>
                    </div>
                </div>
                </body>
                </html>

                <script type="text/javascript">
                    function deletechecked(link)
                    {
                        var answer = confirm('Delete item?')
                        if (answer){
                            window.location = link;
                        }
    
                        return false;  
                    }

                </script>